<template>
  <a-card
  >
    <a-tabs v-model="activeKey">
      <template slot="tabBarExtraContent">
        <a-button size="small" icon="plus" type="primary" @click="addModal">发布帖子</a-button>
      </template>
      <a-tab-pane key="1" tab="全部帖子"></a-tab-pane>
      <a-tab-pane key="2" tab="我的帖子"></a-tab-pane>
    </a-tabs>
    <all v-if="activeKey === '1'"></all>
    <my v-if="activeKey === '2'"></my>
    <add v-if="visible" @cancel="onCancel"></add>
  </a-card>
</template>

<script>
import My from './components/My'
import All from './components/All'
import Add from './components/Add'

export default {
  components: {
    My,
    All,
    Add
  },
  name: 'BBSList',
  data () {
    return {
      visible: false,
      activeKey: '1'
    }
  },
  methods: {
    addModal () {
      this.visible = true
    },
    onSubmit () {
      this.$refs.table.refresh()
    },
    onCancel (visible) {
      this.visible = visible
    }
  }
}
</script>

<style scoped>

</style>
